def pseudo_factor(num: int):
    ret = [1]
    if num % 2 == 0:
        ret.append(2)
        while num % 2 == 0:
            num //= 2
    # 因为是求最大的质因数，所以把num除成奇数不改变最后的结果
    times_floor = int(pow(num, 0.5)) + 1
    # 一个数的质因子不会超过这个数的2次方根，数论里说过，具体证明不记得了
    # print(times_floor)
    i = 3
    while i < times_floor:
        if num % i == 0:
            ret.append(i)
        i += 2
    return ret


if __name__ == '__main__':
    num = 600851475143
    poss = pseudo_factor(num)
    print(poss)
    i = len(poss) - 1
    while len(pseudo_factor(poss[i])) > 1 and i > 0:
        i -= 1
        continue
    print(poss[i])
